package com.fitzone.web.task;

import com.fitzone.web.service.OrdersService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 自定义定时任务类
 */
@Component
@Slf4j
public class MyTask {
    @Autowired
    private OrdersService ordersService;

    /**
     * 定时任务 每天晚上12点
     */
    @Scheduled(cron = "0 0 0 * * ?")
    public void executeTask(){
        ordersService.updateUser();
    }

}
